#include <QtGui/QApplication>
#include "MainWindow.hpp"
#include "LogDisplay.hpp"
#include <QxtLogger>
#include <QxtBasicFileLoggerEngine>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    a.setOrganizationName("BMPlay");
    a.setOrganizationDomain("bmplay.org");
    a.setApplicationName("Secret of Mana");
    //setup logging first

    qxtLog->disableLoggerEngine("DEFAULT");
    QxtBasicFileLoggerEngine *f = new QxtBasicFileLoggerEngine("SoM.log");

    LogDisplay *log = new LogDisplay();
    log->enableLogLevels(QxtLogger::AllLevels);
    f->enableLogLevels(QxtLogger::AllLevels);
    qxtLog->addLoggerEngine("DEF",log);
    qxtLog->addLoggerEngine("FIL",f);
    qxtLog->debug("Started Logging");


    MainWindow w;
    w.show();
    QObject::connect(&w,SIGNAL(destroyed()),&a,SLOT(quit()));

    qxtLog->disableLoggerEngine("DEFAULT");
    QTimer::singleShot(0,&w,SLOT(runMe()));

    return a.exec();
}
